/*
 * XXX
 */

package edu.uhcl.csci4838.group3.view;

import android.app.TabActivity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;
import edu.uhcl.csci4838.group3.R;

/**
 * XXX
 * 
 * @author Chris Bruce
 *
 */
public class HomeActivity extends TabActivity {
	
	/**
	 * XXX
	 * 
	 * @param savedInstanceState
	 */
	/* 
	 * (non-Javadoc)
	 * 
	 * @see android.app.ActivityGroup#onCreate(android.os.Bundle)
	 */
	@Override
	public void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		this.setRequestedOrientation(
					ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		
		this.setContentView(R.layout.activity_home);
		final Resources res = this.getResources();
		final TabHost tabHost = this.getTabHost();
		TabHost.TabSpec spec;
		Intent intent;
		
		// Create an Intent to launch an Activity for the tab(to be reused)s
		intent = new Intent().setClass(this,
				AgendaTabActivity.class);
		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost.newTabSpec("agenda")
				.setIndicator("Agenda",
						res.getDrawable(R.drawable.ic_tab_agenda))
				.setContent(intent);
		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this,
				CalendarActivity.class);
		spec = tabHost.newTabSpec("calendar")
				.setIndicator("Calendar",
						res.getDrawable(R.drawable.ic_tab_calendar))
				.setContent(intent);
		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this,
				CourseListActivity.class);
		spec = tabHost.newTabSpec("courses")
				.setIndicator("Courses",
						res.getDrawable(R.drawable.ic_tab_classlist))
				.setContent(intent);
		tabHost.addTab(spec);
		
		tabHost.setCurrentTabByTag("agenda");
		// TODO things need to be externalized
	}

	/* Stuff for if we ever get fragments
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		return getLocalActivityManager().getCurrentActivity().onCreateOptionsMenu(menu);
		//return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		//return getLocalActivityManager().getCurrentActivity().onPrepareOptionsMenu(menu);
		return super.onPrepareOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		return getLocalActivityManager().getCurrentActivity().onOptionsItemSelected(item);
		//return super.onOptionsItemSelected(item);
	}
	*/
	
}
